﻿using System.Collections.Generic;

public class ChessShi : BaseChess
{
    private Pos[] directions = new Pos[4] { new Pos(-1, -1), new Pos(-1, 1), new Pos(1, -1), new Pos(1, 1) };
    public ChessShi(int camp, int team) : base(camp, team)
    {

    }

    public override void AddSomePosIntoList(BaseChessBoard chessBoard, List<Pos> tempPosList)
    {
        BaseGrid grid = chessBoard.GetGridByChess(this);
        if (grid != null)
        {
            Pos chessPos = grid.GetPos();
            Pos endPos;
            for (int i = 0; i < directions.Length; i++)
            {
                endPos = chessPos.AddResult(directions[i]);
                if (chessBoard.SpaceIsGridAndNotExistChess(endPos) || chessBoard.SpaceIsGridAndExistOtherTeamChess(endPos, GetTeam()))
                {
                    BaseGrid endGrid = chessBoard.GetGridByPos(endPos);
                    StandardGrid sEndGrid = endGrid as StandardGrid;
                    if (sEndGrid != null && sEndGrid.GetIsPalace() == true && sEndGrid.GetCamp() == GetCamp())
                    {
                        tempPosList.Add(endPos);
                    }
                }
            }
        }
    }
    public override Score GetScore(BaseChessBoard baseChessBoard)
    {
        return new Score(4, 0);
    }
}